package com.cros.pruebas;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;



public class PerformanceString {
	private static Log log= LogFactory.getLog(PerformanceString.class);
	/*
	
		if(sbAux.indexOf("SENDFILES")>-1){
        in.read();
        return "SENDFILES";
       }else if (sbAux.indexOf("SENDVALES")>-1){
        in.read();
        return "SENDVALES";
       }else if (sbAux.indexOf("SENDVALE2")>-1){
        in.read();
        return "SENDVALE2";
       }else if (sbAux.length() >= 3 && sbAux.substring(sbAux.length()-3,sbAux.length()).equals(EQN_NUL_NUL)){
        //TamS = "";
        sbAux = new StringBuffer();
        sbAux.append("");
        ContRefreshMemory = -1;
       }else if(sbAux.indexOf("SCKTCLOSE")>-1){
        return "SCKTCLOSE";
       }else if(sbAux.indexOf("SCKT2CLOS")>-1){
        return "SCKTCLOSE";
       }else if(sbAux.indexOf("SENDLGSZP")>-1){
        in.read();
        return "SENDLGSZP";
       }else if(sbAux.indexOf("SENDECCPR")>-1){
        in.read();
        return "SENDECCPR";
       }else if(sbAux.indexOf("REFRESPMS")>-1){
        in.read();
        return "REFRESPMS";
       }else if(sbAux.indexOf("SENDAXML2")>-1 ){
        in.read();
        return "SENDAXML2";
       }
       
       */

	
	public static void main(String... argv){
		
		
		String str="ABCDEFGHIJKLMER";
		
		
		String str2="SCKTCLOSE";
		EnumWorlds enu;
		
		long a = System.currentTimeMillis();
		for(int i=0;i<1000000;i++){
			if(str.equals("SCKTCLOSE")){}
		}
		System.out.println("El tiempo total equals:"+(System.currentTimeMillis()-a)+"ms");
		
		long b=System.currentTimeMillis();
		for(int i=0;i<1000000;i++){
			if(str.indexOf("SCKTCLOSE")>-1){}
		}
		System.out.println("El tiempo total indexOf:"+(System.currentTimeMillis()-b)+"ms");
		
		long d=System.currentTimeMillis();
		for(int i=0;i<1000000;i++){
			if(str.contains("SCKTCLOSE")){}
		}
		System.out.println("El tiempo total contains:"+(System.currentTimeMillis()-d)+"ms");
		
		try{
			enu = EnumWorlds.valueOf(str2);
		}catch(IllegalArgumentException x){
			enu = EnumWorlds.valueOf("DEFAULT");
		}
	
		long c=System.currentTimeMillis();
	
		for(int i=0;i<1000000;i++){
			
			switch(enu){
			case SCKTCLOSE:
				//System.out.println("el close");
				break;
			case SENDFILES:
				//System.out.println("sendfiles");
				break;
			case SENDVALES:
				//System.out.println("sendvales");
				break;
			case SENDVALE2:
				//System.out.println("senvale3");
				break;
		
			default:
				//System.out.println("default");
				break;
			
			
			}
		}
		
		System.out.println("El tiempo total enum:"+(System.currentTimeMillis()-c)+"ms");
		
		long as=System.currentTimeMillis();
		for(int i=0;i<10000;i++){
			log.debug("hello world"+23);
		}
		long ded = System.currentTimeMillis()-as;
		
		
		
		long ds=System.currentTimeMillis();
		for(int i=0;i<10000;i++){
			log.debug(String.format("Hello world %d ",23));
		}
		long be=System.currentTimeMillis()-ds;
		System.out.println("El tiempo sendString1:"+ded);
		System.out.println("El tiempo sendString2:"+be);
		
	}
	

}
